package Service;

import Utils.SqlSessionFactoryUtil;
import dao.UserDao;
import entity.Users;
import org.apache.ibatis.session.SqlSession;

public class UserService {

    public boolean regi(Users user){
        SqlSession sqlSession = SqlSessionFactoryUtil.getSqlSession();
        UserDao userDao = sqlSession.getMapper(UserDao.class);
        boolean b= userDao.registe(user);
        sqlSession.commit();
        sqlSession.close();
        return b;
    }
    public Users login(Users user){
        SqlSession sqlSession = SqlSessionFactoryUtil.getSqlSession();
        UserDao userDao = sqlSession.getMapper(UserDao.class);
        Users user1 = userDao.login(user);
        sqlSession.close();
        return user1;
    }
}
